﻿@model IEnumerable<HanGu.Entity.VChangeChargeRecorde>
@{
    Layout = null;
    int i = 1;
    ViewBag.ViewTitle = "积分记录";
    var SearchParma = ViewData["SearchParma"] as HanGu.Entity.UniversallySearchParam;
    var action = Request["action"];
    int memberid = 0;
    int.TryParse(ViewData["ParentID"].ToString(), out memberid);
    var read = memberid == 0;
    if (!string.IsNullOrEmpty(action))
    {
        read = action == "read";
    }
    var CurentUser = Session["CurentUser"] as HanGu.Entity.CurrentUserDTO;
    if (CurentUser != null && CurentUser.Roles.SingleOrDefault(c => c.ID == "CustomerInfo_10") != null)
    {
        read = false;
    }
    else
    { read = true; }
    var ChagerValue = TempData["ChargeValue"];
    TempData["ChargeValue"] = ChagerValue;

    int SourceValueTotal = 0;
    int changeValueTotal = 0;
}
<div class="pageContent">
    <script>
        function mydialogAjaxDone(json) {
            DWZ.ajaxDone(json);
            if (json.statusCode == DWZ.statusCode.ok) {
                if (json.navTabId) {
                    var $this = $("#" + json.navTabId);
                    $this.loadUrl($this.attr("ref"));
                } else if (json.rel) {
                    navTabPageBreak({}, json.rel);
                }
                if ("closeCurrent" == json.callbackType) {
                    $.pdialog.closeCurrent();
                }
            }
        }
    </script>
    <div class="panelBar">
        <ul class="toolBar">
            @if (!read)
            {<li><a class="add" href="CustomerInfo/ChangeChargeRecorde/create/0/@ViewData["ParentID"]" target="dialog" width="800" height="500" title="添加-@ViewBag.ViewTitle">
                <span>添加</span></a></li>
            }
            <li><span style="color: Red; font-weight: bold;">现有积分：@ChagerValue</span> </li>
        </ul>
    </div>
    <table class="table" width="100%" layouth="110">
        <thead>
            <tr class="header">
                <th style="width: 150px">
                    序号
                </th>
                <th>
                    时间
                </th>
                <th>
                    原有积分
                </th>
                <th>
                    改变积分
                </th>
                <th>
                    操作人
                </th>
                <th>
                    备注
                </th>
            </tr>
        </thead>
        @foreach (var item in Model)
        {
            SourceValueTotal += item.SourceValue;
            changeValueTotal += item.ChangeValue;
                    
            <tr target="@ViewData["CurrentController"]_id" rel="@item.ID" >
                <td>
                    @i
                </td>
                <td>
                    <span formatdate="yyyy年MM月dd日 hh时mm分">@item.ChangeTime</span>
                </td>
                <td>
                    <img src="/Content/images/money.png" />&nbsp; @item.SourceValue
                </td>
                <td>
                    <img src="/Content/images/money.png" />&nbsp; @item.ChangeValue
                </td>
                <td>
                    @item.Changer
                </td>
                <td>
                    @item.ChangeReason
                </td>
            </tr>
            i += 1;
        }
        <tr>
            <td>
            </td>
            <td style="text-align: right">
                总额：
            </td>
            <td>
                <img src="/Content/images/money.png" />&nbsp; @SourceValueTotal
            </td>
            <td>
                <img src="/Content/images/money.png" />&nbsp; @changeValueTotal
            </td>
            <td>
                现有积分：@ChagerValue
            </td>
        </tr>
    </table>
</div>
@*<div class="panelBar">
    <div class="pages">
        <span>共【@ViewData["RowCount"] 】条,每页显示【@ViewData["pageSize"] 】条</span>
    </div>
    <div class="pagination" targettype="navTab" totalcount="@ViewData["RowCount"] "
            numperpage="@ViewData["pageSize"] " pagenumshown="10" currentpage="@Request["pageNum"] ">
    </div>
</div>*@ 